import Cookies from "js-cookie";

const TokenKey = "Admin-Token";
const expires = 1; // 过期时间，单位 天，默认 1 天到期
// const expires = new Date(new Date().getTime() + 7 * 24 * 3600000); 一天之内

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token, option = { expires }) {
  return Cookies.set(TokenKey, token, option);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}
